package com.sihai.ehr.web.pojo;

import com.sihai.ehr.utils.DateUtil;
import org.apache.commons.lang.xwork.StringUtils;

import java.util.Calendar;
import java.util.Date;

/**
 * author: wxn
 * since: 13-5-21 下午11:09
 */
public class SearchFormPojo {
    private String startDateStr;
    private String endDateStr;

    private Date startDate;
    private Date endDate;
    private Long orgId;
    private Long dutyId;

    private boolean show;

    public SearchFormPojo() {
    }

    public Date getStartDate() {
        if(startDate == null){
            if(StringUtils.isNotBlank(startDateStr)){
                return DateUtil.createDate(startDateStr, "yyyy-MM-dd");
            }
        }
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        if(endDate == null){
            if(StringUtils.isNotBlank(endDateStr)){
                return DateUtil.createDate(endDateStr, "yyyy-MM-dd");
            }
        }
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Long getOrgId() {
        if(orgId != null && orgId > 0){
            return orgId;
        }
        return null;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public Long getDutyId() {
        if(dutyId != null && dutyId > 0){
            return dutyId;
        }
        return null;
    }

    public void setDutyId(Long dutyId) {
        this.dutyId = dutyId;
    }

    public boolean isShow() {
        return show;
    }

    public void setShow(boolean show) {
        this.show = show;
    }

    public String getStartDateStr() {
        return startDateStr;
    }

    public void setStartDateStr(String startDateStr) {
        this.startDateStr = startDateStr;
    }

    public String getEndDateStr() {
        return endDateStr;
    }

    public void setEndDateStr(String endDateStr) {
        this.endDateStr = endDateStr;
    }
}
